<script setup lang="ts">
import { onMounted, ref } from "vue";
import { Banner, bannerApi } from "@/apis/home";

let banner = ref([] as Banner[]);
onMounted(() => {
  bannerApi().then((res) => {
    banner.value = res;
    console.log(JSON.stringify(res));
  });
});
</script>

<template>
  <div class="home-banner">
    <el-carousel height="500px">
      <el-carousel-item v-for="item in banner" :key="item.id">
        <img :src="item.imgUrl" alt="" />
        <!-- content -->
      </el-carousel-item>
    </el-carousel>
  </div>
</template>

<style lang="scss" scoped>
.home-banner {
  height: 500px;
  width: 1240px;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 98;
  img {
    width: 100%;
    height: 500px;
  }
}
</style>
